#include <iostream>
#include <vector>
using namespace std;
//		   123123123123123
char one[16]		= "     |     |   ";
char two[16]		= " -   | - |   - ";
char three[16]		= " -   | -   | - ";
char four[16] 		= "   | | -   |   ";
char five[16] 		= " - |   -   | - ";
char six[16]		= " - |   - | | - ";
char seven[16]		= " -   |     |   ";
char eight[16]		= " - | | - | | - ";
char nine[16] 		= " - | | -   | - ";
char zero[16]		= " - | |   | | - ";
char* nums[10] = {zero, one, two, three, four, five, six, seven, eight, nine};

void printRow(int size, int row, char* c){
	cout << c[row*3];
	for(int i = 0; i < size; ++i){
		cout << c[row*3+1];
	}
	cout << c[row*3+2];
}

void printAllRows(int size, int row, const string& num){
	for(size_t ch = 0; ch < num.size(); ++ch){
		char* c = nums[num[ch]-'0'];
		printRow(size, row, c);
		if(ch < num.size()-1)
			cout << " ";
	}
	cout << endl;
}	

void print(int size, const string& num){
	printAllRows(size,0,num);
	for(int i =0; i < size; ++i)
		printAllRows(size,1,num);
	printAllRows(size,2,num);
	for(int i = 0; i < size; ++i)
		printAllRows(size,3,num);
	printAllRows(size,4,num);
}

int main(){
	int size;
	string num;
	while(cin >> size >> num){
		if(size == 0)
			break;
		print(size, num);
		cout << endl;
	}
}
